package severlet;

import bean.Fee;
import dao.FeeDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet(name = "AdminFeeServlet", value = "/AdminFeeServlet")
public class AdminFeeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");

        //调用dao层
        FeeDao feeDao=new FeeDao();
        //查询
        ArrayList<Fee> allFeeInfo = feeDao.getAllFeeInfo();
        //存入Session 用于前端调用显示信息
        request.getSession().setAttribute("adminFee",allFeeInfo);
        //跳转
        request.getRequestDispatcher("admin_fee.jsp").forward(request,response);
    }
}
